package com.huluobo.high3demo.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.high3demo.R;
import com.huluobo.mvvm.baen.CommentBeanResult;
import com.huluobo.mvvm.utils.ImageLoader;

import java.util.List;

/**
 * Created by LC on 2023/9/20.
 */
public class CommentAdapter extends BaseQuickAdapter<CommentBeanResult.CommentBean, BaseViewHolder> {
    public CommentAdapter(@Nullable List<CommentBeanResult.CommentBean> data) {
        super(R.layout.item_comment_layout, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, CommentBeanResult.CommentBean commentBean) {
        ImageView headView = baseViewHolder.getView(R.id.comment_icon);
        ImageLoader.getInstance().loadCircleImage(getContext(), commentBean.getIcon(), headView);

        baseViewHolder.setText(R.id.comment_name, commentBean.getUsername());
        baseViewHolder.setText(R.id.comment_msg, commentBean.getMsg());
        baseViewHolder.setText(R.id.comment_time, commentBean.getCreatetime());
    }
}
